{extend name="pub/base2" /}
{block name="title"}
<title>章节管理</title>
{/block}

{block name="body"}
<section class="Hui-admin-article">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px"><i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        漫画管理
        <span class="c-gray en">&gt;</span>
        章节管理
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <div class="panel mt-20">
        <div class="panel-body">
            <div class="clearfix">
                <div class="formControls col-xs-3 col-sm-3">
                    <a href="javascript:;" onclick="delAll('请选择要删除的章节','chapters')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
                    <a class="btn btn-primary radius" href="{:url('chapters/create',['book_id'=>$book.id])}">添加章节</a>
                </div>
                <div class="formControls col-xs-3 col-sm-3">
                    <span class="r">共有数据：<strong>{$count}</strong> 条</span>
                </div>
            </div>
            <div class="mt-20 clearfix">
                <table class="table table-border table-bordered table-bg table-hover table-sort">
                    <thead>
                    <tr class="text-c">
                        <th><input id="cbx" type="checkbox" value=""></th>
                        <th>ID</th>
                        <th>章节名</th>
                        <th>章节序</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="chapters" id="vo"}
                    <tr class="text-c">
                        <td><input data-val="{$vo.id}" class="cbx" type="checkbox" value=""></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.chapter_name}</td>
                        <td>{$vo.chapter_order}</td>
                        <td>{$vo.create_time|date='Y-m-d H:i'}</td>
                        <td>{$vo.update_time|date='Y-m-d H:i'}</td>
                        <td class="f-14 td-manage">
                            <a href="{$vo.content_url}" target="_blank" class="btn radius btn-success size-S">
                                内容查看
                            </a>
                            <a style="text-decoration:none" class="ml-5" onclick="editCreate('章节编辑','{:url(\'chapters/edit\',[\'id\'=>$vo.id])}')">
                                <i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                            <a style="text-decoration:none" class="ml-5" onclick="del(this,{$vo.id})"
                               href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                {$chapters|raw}
            </div>
        </div>
    </div>
</section>
<script>
    $('#cbx').click(function () {
        var cbxs = $('.cbx');
        var flag = $('#cbx').prop("checked");
        $.each(cbxs, function (index, value) {
            $(value).prop("checked", flag);
        })
    })
</script>
{/block}
